package com.ww.core.widget.spinner;

import java.util.ArrayList;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ww.core.R;

public class MpSpinnerAdapter extends BaseAdapter {
	private Context context;
	private ArrayList<String> list;

	public MpSpinnerAdapter(Context context, ArrayList<String> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		TextView textView = new TextView(context);
		textView.setText(list.get(arg0));
		textView.setHeight(80);
		textView.setGravity(Gravity.CENTER_VERTICAL);
		textView.setTextSize(18);
		textView.setPadding(10, 0, 0, 0);
		textView.setTextColor(context.getResources().getColor(R.color.dialog_txt));
		textView.setBackgroundResource(R.drawable.mylist_item);
		return textView;
	}

}
